/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main.LanguageResource;

import java.util.HashSet;
import java.util.Set;

/**
 *
 * @author Isaac Osesina
 */
public class DefaultWordConstruct implements WordConstruct<LocalPOS> {
    
    private final String word;
    private Set<String> syns;
    String lemma;
    LocalPOSFactory factory;
    private String sourcePOS;

    public DefaultWordConstruct(LocalPOSFactory factory, String word) {
        this.factory = factory;
        this.word = word;
    }    
    
    
    /**
     * 
     * @return word used to create this construct
     */
    @Override
    public String getWord() {
        return word;
    }
    
    /**
     * 
     * @return Lemma of the processed word
     */
    @Override
    public String getLemma() {
        return lemma;
    }
    
    /**
     * 
     * @return the Part-of-Speech tag as produced by the NLP
     */
    @Override
    public LocalPOS getPOS() {
        return factory.getPos(sourcePOS);
    }
    
    /**
     * 
     * @return set of synonyms of the word used to create construct
     */
    @Override
    public Set<String> getSynonyms() {
        return syns;
    }

    @Override
    public void setPOS(LocalPOS POS) {
        factory.addPos(POS);
        sourcePOS = POS.getValue();
    }
    
    @Override
    public void setPOS(String pos) {
        LocalPOS addPos = factory.addPos(pos);
        sourcePOS = addPos.getValue();
    }

    @Override
    public void setLemma(String lemma) {
        this.lemma = lemma;
    }

    @Override
    public void setSyn(Set<String> syn) {
        this.syns = syn;
    }
    
    @Override
    public void addSyn(String syn) {
        syns = syns==null ? new HashSet<String>():syns;
        syns.add(syn);
    }
    
}
